﻿using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace OpenCompiler.Scanning.Tests.Specs_for_scanner
{
	[TestClass]
	public class When_scanning_for_comments
	{
		[TestMethod]
		public void Multiple_adhoc_comments_seperated_by_newline_are_tokenized()
		{
			const string sourceCode = "// This is a comment\n// This is a second comment";
			var tokens = TokenTestHelper.Tokenize(sourceCode);
			Assert.AreEqual(4, tokens.Count);
		}

		[TestMethod]
		public void Comments_with_start_and_end_are_tokenized()
		{
			const string sourceCode = "/* A comment with start and stop */\n/* and a second comment */";
			var tokens = TokenTestHelper.Tokenize(sourceCode);
			Assert.AreEqual(4,tokens.Count);
		}

		[TestMethod]
		public void Comments_with_start_and_end_spanning_multiple_lines_are_tokenized()
		{
			const string sourceCode = "/* A comment \n spanning multiple \n lines are recognized */";
			var tokens = TokenTestHelper.Tokenize(sourceCode);
			Assert.AreEqual(2,tokens.Count);
		}
	}
}